<?php
$collections = Groo::listCollections();

// Check here for guest collections so that we don't get multiple
// messages after redirects, etc.
if (!Auth::getAuth() && !count(Groo::listCollections())) {
    $notification->push(_("No collections are available to guests."));
}
?>
<form action="list.php" method="post" name="collectionsmenu">
<?php echo Util::formInput() ?>
<div id="menu">
<?php if (!$prefs->isLocked('default_collection') && (count($collections) > 1 || !count($GLOBALS['display_collections']))): ?>
 <div style="float:right">
<select name="display_collection" onchange="collectionSubmit();">
  <option value=""><?php echo _("Select collections to display:") ?></option>
<?php foreach ($collections as $id => $collection): ?>
  <option value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $GLOBALS['display_collections']) ? ' class="selected"' : '') . '>' . htmlspecialchars($collection->get('name')) ?></option>
<?php endforeach; ?>
</select>
 </div>
<?php endif; ?>

 <?php echo Groo::getMenu('string') ?>
 <br class="clear" />
</div>
</form>

<script type="text/javascript">
<!--
function collectionSubmit()
{
    document.collectionsmenu.submit();
    return false;
}
// -->
</script>

<?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
